<?php
/**
 * Joomla! 1.5 component ArticleCashRewards
 *
 * @version $Id: view.html.php 2009-05-10 01:47:01 svn $
 * @author Maverick
 * @package Joomla
 * @subpackage components.views
 * @link http://joomladev.boddunan.com
 * @license GNU/GPL
 *
 * Review and approve the articles and assign points and cash rewards.
 * Users can see their articles and the points/cash rewards assigned in the front-end module.
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view');

/**
 * HTML View class for the ArticleCashRewards component
 */
class ArticleCashRewardsViewMyPage extends JView {

    function __construct()       {
        $config = array();
        $config['layout'] = 'articles';
        parent::__construct($config);
    }
	
    function display($tpl = null) {
		
        global $acr_config;
        
        $model = $this->getModel('mypage');
                
        $params = JComponentHelper::getParams('com_articlecashrewards');
        
        $this->assignRef( 'params', $params );
        $this->assignRef( 'acr_config', $acr_config);
        
        if($this->getLayout() == 'myprofile') {
            $dashboard =& $model->getDashboard();
            $this->assignRef( 'dashboard', $dashboard );

        }else if($this->getLayout() == 'articles') {
            $articles =& $model->getUserArticles();
            $pagination =& $model->getPagination();

            $this->assignRef( 'rows', $articles->rows );
            $this->assignRef( 'stats', $articles->lists );
            $this->assignRef( 'pagination', $pagination);

        }else if($this->getLayout() == 'referrals') {
            $referrals =& $model->getUserReferrals();
            $pagination =& $model->getPagination();

            $this->assignRef( 'rows', $referrals );
            $this->assignRef( 'pagination', $pagination);

        }else if($this->getLayout() == 'paymentinfo') {
            $profile =& $model->getMyProfile();
            $this->assignRef( 'profile', $profile );
            
        }else if($this->getLayout() == 'weblinks') {
            $weblinks =& $model->getWebLinks();
            $pagination =& $model->getPagination();
            $this->assignRef( 'weblinks', $weblinks->rows );
            $this->assignRef( 'lists', $weblinks->lists );
            $this->assignRef( 'pagination', $pagination);
        }
			
   		parent::display($tpl);
	}
}
?>